/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mundialfp.view.main;

import java.util.HashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import mundialfp.view.tables.TableBombo;
import mundialfp.view.tables.TableCustom2;
import uy.com.pzit.fpmundialmodel.web.ws.Eliminatoria;

/**
 *
 * @author pferraz
 */
public class Principal extends javax.swing.JFrame {

    private final Map<Integer, String> tabNames;
    private final TableCustom2 tblTablaAFC;
    private final TableCustom2 tblTablaConmebol;
    private final TableCustom2 tblTablaCAF;
    private final TableCustom2 tblTablaCONCACAF;
    private final TableCustom2 tblTablaOFC;
    private final TableCustom2 tblTablaUEFA1;
    private final TableCustom2 tblTablaUEFA2;
    private final TableCustom2 tblTablaUEFA3;
    private final TableCustom2 tblTablaUEFA4;
    private final TableBombo tblBombo1;
    private final TableBombo tblBombo2;
    private final TableBombo tblBombo3;
    private final TableBombo tblBombo4;
    private final Map<String, TableCustom2> mapElimTable;
    private final PrincipalManager manager;

    /**
     * Creates new form Start
     */
    public Principal() {
        manager = new PrincipalManager(this);
        this.tabNames = new HashMap<>();
        this.mapElimTable = new HashMap<>();
        this.tblTablaAFC = new TableCustom2(11);
        this.tblTablaConmebol = new TableCustom2(11);
        this.tblTablaCAF = new TableCustom2(11);
        this.tblTablaCONCACAF = new TableCustom2(11);
        this.tblTablaOFC = new TableCustom2(11);
        this.tblTablaUEFA1 = new TableCustom2(11);
        this.tblTablaUEFA2 = new TableCustom2(11);
        this.tblTablaUEFA3 = new TableCustom2(11);
        this.tblTablaUEFA4 = new TableCustom2(11);
        this.tblBombo1=new TableBombo(2);
        this.tblBombo2=new TableBombo(2);
        this.tblBombo3=new TableBombo(2);
        this.tblBombo4=new TableBombo(2);

        this.mapElimTable.put("AFC", this.tblTablaAFC);
        this.mapElimTable.put("CONMEBOL", this.tblTablaConmebol);
        this.mapElimTable.put("CONCACAF", this.tblTablaCONCACAF);
        this.mapElimTable.put("OFC", this.tblTablaOFC);
        this.mapElimTable.put("CAF", this.tblTablaCAF);
        this.mapElimTable.put("UEFA1", this.tblTablaUEFA1);
        this.mapElimTable.put("UEFA2", this.tblTablaUEFA2);
        this.mapElimTable.put("UEFA3", this.tblTablaUEFA3);
        this.mapElimTable.put("UEFA4", this.tblTablaUEFA4);
        initComponents();
        loadForm();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        frmMundialFifaX = new javax.swing.JFrame();
        pnlMundialFifaX = new javax.swing.JPanel();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        pnlMundial = new javax.swing.JPanel();
        tbpMundial = new javax.swing.JTabbedPane();
        pnlEliminatorias = new javax.swing.JPanel();
        tbpConfederaciones = new javax.swing.JTabbedPane();
        pnlAfc = new javax.swing.JPanel();
        pnlCaf = new javax.swing.JPanel();
        pnlConcacaf = new javax.swing.JPanel();
        pnlConmebol = new javax.swing.JPanel();
        pnlOfc = new javax.swing.JPanel();
        pnlUefa = new javax.swing.JPanel();
        tbpUefa = new javax.swing.JTabbedPane();
        pnlUefa1 = new javax.swing.JPanel();
        pnlUefa2 = new javax.swing.JPanel();
        pnlUefa3 = new javax.swing.JPanel();
        pnlUefa4 = new javax.swing.JPanel();
        btnRegistrarEncuentro = new javax.swing.JButton();
        btnIniciarElim = new javax.swing.JButton();
        btnPasarASorteo = new javax.swing.JButton();
        pnlSorteo = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblBombo_1 = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblBombo_2 = new javax.swing.JTable();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblBombo_4 = new javax.swing.JTable();
        jScrollPane4 = new javax.swing.JScrollPane();
        tblBombo_3 = new javax.swing.JTable();
        btnSorteoInit = new javax.swing.JButton();
        pnlFaseGrupos = new javax.swing.JPanel();
        tbpGrupos = new javax.swing.JTabbedPane();
        pnlGrupoA = new javax.swing.JPanel();
        pnlGrupoB = new javax.swing.JPanel();
        pnlGrupoC = new javax.swing.JPanel();
        pnlGrupoD = new javax.swing.JPanel();
        pnlGrupoE = new javax.swing.JPanel();
        pnlGrupoF = new javax.swing.JPanel();
        pnlGrupoG = new javax.swing.JPanel();
        pnlGrupoH = new javax.swing.JPanel();
        btnIniciarElim1 = new javax.swing.JButton();
        pnlOctavos = new javax.swing.JPanel();
        pnlCuartos = new javax.swing.JPanel();
        pnlSemi = new javax.swing.JPanel();
        pnlFinal = new javax.swing.JPanel();
        pnlMainHeader = new javax.swing.JPanel();
        lblNroMundTitle = new javax.swing.JLabel();
        lblNroMundial = new javax.swing.JLabel();
        lblInicioMundTitle = new javax.swing.JLabel();
        lblFechaInicio = new javax.swing.JLabel();
        lblFinMundTitle = new javax.swing.JLabel();
        lblFechaFin = new javax.swing.JLabel();
        lblAnfitrionMundTitle = new javax.swing.JLabel();
        lblBanderaAnf = new javax.swing.JLabel();
        lblNombreAnfitrion = new javax.swing.JLabel();
        pnlMainLoad = new javax.swing.JPanel();
        lblLoad = new javax.swing.JLabel();
        lblBallLoad = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        mnuPrincipal = new javax.swing.JMenuBar();
        mnuMundial = new javax.swing.JMenu();
        mnuNuevo = new javax.swing.JMenu();
        mnuItNew = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        mnuMundialHist = new javax.swing.JMenuItem();
        mnuEnCurso = new javax.swing.JMenu();
        mnuItEnCursoStandar = new javax.swing.JMenuItem();
        mnuItEnCursoFifaX = new javax.swing.JMenuItem();
        mnuEstad = new javax.swing.JMenu();
        mnuRankingFifa = new javax.swing.JMenuItem();
        mnuAdministracion = new javax.swing.JMenu();
        mnuAdmPais = new javax.swing.JMenuItem();
        mnuAdmConfe = new javax.swing.JMenuItem();

        frmMundialFifaX.setTitle("Mundial Fifa 15");
        frmMundialFifaX.setMaximumSize(new java.awt.Dimension(1920, 1080));
        frmMundialFifaX.setMinimumSize(new java.awt.Dimension(950, 600));
        frmMundialFifaX.setName("frmMundialFifaX"); // NOI18N
        frmMundialFifaX.setPreferredSize(new java.awt.Dimension(950, 600));
        frmMundialFifaX.setResizable(false);

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CAF-AFC-OFC-CONCACAF", "CONMEBOL", "UEFA1" }));

        jLabel1.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        jLabel1.setText("Eliminatoria / Grupo");

        javax.swing.GroupLayout pnlMundialFifaXLayout = new javax.swing.GroupLayout(pnlMundialFifaX);
        pnlMundialFifaX.setLayout(pnlMundialFifaXLayout);
        pnlMundialFifaXLayout.setHorizontalGroup(
            pnlMundialFifaXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMundialFifaXLayout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(jLabel1)
                .addGap(28, 28, 28)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(221, Short.MAX_VALUE))
        );
        pnlMundialFifaXLayout.setVerticalGroup(
            pnlMundialFifaXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMundialFifaXLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(pnlMundialFifaXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addContainerGap(382, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout frmMundialFifaXLayout = new javax.swing.GroupLayout(frmMundialFifaX.getContentPane());
        frmMundialFifaX.getContentPane().setLayout(frmMundialFifaXLayout);
        frmMundialFifaXLayout.setHorizontalGroup(
            frmMundialFifaXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlMundialFifaX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        frmMundialFifaXLayout.setVerticalGroup(
            frmMundialFifaXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, frmMundialFifaXLayout.createSequentialGroup()
                .addComponent(pnlMundialFifaX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("v1.3.0");
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        pnlMundial.setBackground(java.awt.Color.white);
        pnlMundial.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        tbpMundial.setBackground(java.awt.Color.white);
        tbpMundial.setFont(new java.awt.Font("Trebuchet MS", 1, 13)); // NOI18N

        tbpConfederaciones.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        tbpConfederaciones.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N

        javax.swing.GroupLayout pnlAfcLayout = new javax.swing.GroupLayout(pnlAfc);
        pnlAfc.setLayout(pnlAfcLayout);
        pnlAfcLayout.setHorizontalGroup(
            pnlAfcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 842, Short.MAX_VALUE)
        );
        pnlAfcLayout.setVerticalGroup(
            pnlAfcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpConfederaciones.addTab("AFC", pnlAfc);

        javax.swing.GroupLayout pnlCafLayout = new javax.swing.GroupLayout(pnlCaf);
        pnlCaf.setLayout(pnlCafLayout);
        pnlCafLayout.setHorizontalGroup(
            pnlCafLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 842, Short.MAX_VALUE)
        );
        pnlCafLayout.setVerticalGroup(
            pnlCafLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpConfederaciones.addTab("CAF", pnlCaf);

        javax.swing.GroupLayout pnlConcacafLayout = new javax.swing.GroupLayout(pnlConcacaf);
        pnlConcacaf.setLayout(pnlConcacafLayout);
        pnlConcacafLayout.setHorizontalGroup(
            pnlConcacafLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 842, Short.MAX_VALUE)
        );
        pnlConcacafLayout.setVerticalGroup(
            pnlConcacafLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpConfederaciones.addTab("CONCACAF", pnlConcacaf);

        javax.swing.GroupLayout pnlConmebolLayout = new javax.swing.GroupLayout(pnlConmebol);
        pnlConmebol.setLayout(pnlConmebolLayout);
        pnlConmebolLayout.setHorizontalGroup(
            pnlConmebolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 842, Short.MAX_VALUE)
        );
        pnlConmebolLayout.setVerticalGroup(
            pnlConmebolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpConfederaciones.addTab("CONMEBOL", pnlConmebol);

        javax.swing.GroupLayout pnlOfcLayout = new javax.swing.GroupLayout(pnlOfc);
        pnlOfc.setLayout(pnlOfcLayout);
        pnlOfcLayout.setHorizontalGroup(
            pnlOfcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 842, Short.MAX_VALUE)
        );
        pnlOfcLayout.setVerticalGroup(
            pnlOfcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpConfederaciones.addTab("OFC", pnlOfc);

        javax.swing.GroupLayout pnlUefa1Layout = new javax.swing.GroupLayout(pnlUefa1);
        pnlUefa1.setLayout(pnlUefa1Layout);
        pnlUefa1Layout.setHorizontalGroup(
            pnlUefa1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 837, Short.MAX_VALUE)
        );
        pnlUefa1Layout.setVerticalGroup(
            pnlUefa1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 420, Short.MAX_VALUE)
        );

        tbpUefa.addTab("UEFA 1", pnlUefa1);

        javax.swing.GroupLayout pnlUefa2Layout = new javax.swing.GroupLayout(pnlUefa2);
        pnlUefa2.setLayout(pnlUefa2Layout);
        pnlUefa2Layout.setHorizontalGroup(
            pnlUefa2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 837, Short.MAX_VALUE)
        );
        pnlUefa2Layout.setVerticalGroup(
            pnlUefa2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 420, Short.MAX_VALUE)
        );

        tbpUefa.addTab("UEFA 2", pnlUefa2);

        javax.swing.GroupLayout pnlUefa3Layout = new javax.swing.GroupLayout(pnlUefa3);
        pnlUefa3.setLayout(pnlUefa3Layout);
        pnlUefa3Layout.setHorizontalGroup(
            pnlUefa3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 837, Short.MAX_VALUE)
        );
        pnlUefa3Layout.setVerticalGroup(
            pnlUefa3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 420, Short.MAX_VALUE)
        );

        tbpUefa.addTab("UEFA 3", pnlUefa3);

        javax.swing.GroupLayout pnlUefa4Layout = new javax.swing.GroupLayout(pnlUefa4);
        pnlUefa4.setLayout(pnlUefa4Layout);
        pnlUefa4Layout.setHorizontalGroup(
            pnlUefa4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 837, Short.MAX_VALUE)
        );
        pnlUefa4Layout.setVerticalGroup(
            pnlUefa4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 420, Short.MAX_VALUE)
        );

        tbpUefa.addTab("UEFA 4", pnlUefa4);

        javax.swing.GroupLayout pnlUefaLayout = new javax.swing.GroupLayout(pnlUefa);
        pnlUefa.setLayout(pnlUefaLayout);
        pnlUefaLayout.setHorizontalGroup(
            pnlUefaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tbpUefa)
        );
        pnlUefaLayout.setVerticalGroup(
            pnlUefaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tbpUefa)
        );

        tbpConfederaciones.addTab("UEFA", pnlUefa);

        btnRegistrarEncuentro.setText("Registrar Encuentro");
        btnRegistrarEncuentro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRegistrarEncuentroActionPerformed(evt);
            }
        });

        btnIniciarElim.setText("Iniciar");
        btnIniciarElim.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIniciarElimActionPerformed(evt);
            }
        });

        btnPasarASorteo.setFont(new java.awt.Font("Trebuchet MS", 0, 11)); // NOI18N
        btnPasarASorteo.setText("Pasar a sorteo");
        btnPasarASorteo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPasarASorteoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlEliminatoriasLayout = new javax.swing.GroupLayout(pnlEliminatorias);
        pnlEliminatorias.setLayout(pnlEliminatoriasLayout);
        pnlEliminatoriasLayout.setHorizontalGroup(
            pnlEliminatoriasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEliminatoriasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnRegistrarEncuentro)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnPasarASorteo)
                .addGap(48, 48, 48)
                .addComponent(btnIniciarElim)
                .addContainerGap())
            .addGroup(pnlEliminatoriasLayout.createSequentialGroup()
                .addComponent(tbpConfederaciones, javax.swing.GroupLayout.PREFERRED_SIZE, 925, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 10, Short.MAX_VALUE))
        );
        pnlEliminatoriasLayout.setVerticalGroup(
            pnlEliminatoriasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEliminatoriasLayout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addGroup(pnlEliminatoriasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnRegistrarEncuentro)
                    .addComponent(btnIniciarElim)
                    .addComponent(btnPasarASorteo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tbpConfederaciones, javax.swing.GroupLayout.PREFERRED_SIZE, 453, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tbpMundial.addTab(" Eliminatorias ", pnlEliminatorias);

        tblBombo_1.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        tblBombo_1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "1 - CABEZA DE SERIE"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tblBombo_1);

        tblBombo_2.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        tblBombo_2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "2 - CONMEBOL-AFC"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(tblBombo_2);

        tblBombo_4.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        tblBombo_4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "4 - UEFA"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(tblBombo_4);

        tblBombo_3.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        tblBombo_3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "3 - CONCACAF-OFC"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane4.setViewportView(tblBombo_3);

        btnSorteoInit.setFont(new java.awt.Font("Trebuchet MS", 1, 13)); // NOI18N
        btnSorteoInit.setText("Iniciar Sorteo");
        btnSorteoInit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSorteoInitActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlSorteoLayout = new javax.swing.GroupLayout(pnlSorteo);
        pnlSorteo.setLayout(pnlSorteoLayout);
        pnlSorteoLayout.setHorizontalGroup(
            pnlSorteoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSorteoLayout.createSequentialGroup()
                .addGroup(pnlSorteoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlSorteoLayout.createSequentialGroup()
                        .addGap(77, 77, 77)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlSorteoLayout.createSequentialGroup()
                        .addGap(378, 378, 378)
                        .addComponent(btnSorteoInit, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(88, 88, 88))
        );
        pnlSorteoLayout.setVerticalGroup(
            pnlSorteoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSorteoLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(pnlSorteoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlSorteoLayout.createSequentialGroup()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(46, Short.MAX_VALUE))
                    .addGroup(pnlSorteoLayout.createSequentialGroup()
                        .addGroup(pnlSorteoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 367, Short.MAX_VALUE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnSorteoInit, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(21, 21, 21))))
        );

        tbpMundial.addTab(" Sorteo ", pnlSorteo);

        tbpGrupos.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        tbpGrupos.setFont(new java.awt.Font("Trebuchet MS", 1, 24)); // NOI18N

        javax.swing.GroupLayout pnlGrupoALayout = new javax.swing.GroupLayout(pnlGrupoA);
        pnlGrupoA.setLayout(pnlGrupoALayout);
        pnlGrupoALayout.setHorizontalGroup(
            pnlGrupoALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoALayout.setVerticalGroup(
            pnlGrupoALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("A", pnlGrupoA);

        javax.swing.GroupLayout pnlGrupoBLayout = new javax.swing.GroupLayout(pnlGrupoB);
        pnlGrupoB.setLayout(pnlGrupoBLayout);
        pnlGrupoBLayout.setHorizontalGroup(
            pnlGrupoBLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoBLayout.setVerticalGroup(
            pnlGrupoBLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("B", pnlGrupoB);

        javax.swing.GroupLayout pnlGrupoCLayout = new javax.swing.GroupLayout(pnlGrupoC);
        pnlGrupoC.setLayout(pnlGrupoCLayout);
        pnlGrupoCLayout.setHorizontalGroup(
            pnlGrupoCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoCLayout.setVerticalGroup(
            pnlGrupoCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("C", pnlGrupoC);

        javax.swing.GroupLayout pnlGrupoDLayout = new javax.swing.GroupLayout(pnlGrupoD);
        pnlGrupoD.setLayout(pnlGrupoDLayout);
        pnlGrupoDLayout.setHorizontalGroup(
            pnlGrupoDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoDLayout.setVerticalGroup(
            pnlGrupoDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("D", pnlGrupoD);

        javax.swing.GroupLayout pnlGrupoELayout = new javax.swing.GroupLayout(pnlGrupoE);
        pnlGrupoE.setLayout(pnlGrupoELayout);
        pnlGrupoELayout.setHorizontalGroup(
            pnlGrupoELayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoELayout.setVerticalGroup(
            pnlGrupoELayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("E", pnlGrupoE);

        javax.swing.GroupLayout pnlGrupoFLayout = new javax.swing.GroupLayout(pnlGrupoF);
        pnlGrupoF.setLayout(pnlGrupoFLayout);
        pnlGrupoFLayout.setHorizontalGroup(
            pnlGrupoFLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoFLayout.setVerticalGroup(
            pnlGrupoFLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("F", pnlGrupoF);

        javax.swing.GroupLayout pnlGrupoGLayout = new javax.swing.GroupLayout(pnlGrupoG);
        pnlGrupoG.setLayout(pnlGrupoGLayout);
        pnlGrupoGLayout.setHorizontalGroup(
            pnlGrupoGLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoGLayout.setVerticalGroup(
            pnlGrupoGLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("G", pnlGrupoG);

        javax.swing.GroupLayout pnlGrupoHLayout = new javax.swing.GroupLayout(pnlGrupoH);
        pnlGrupoH.setLayout(pnlGrupoHLayout);
        pnlGrupoHLayout.setHorizontalGroup(
            pnlGrupoHLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 888, Short.MAX_VALUE)
        );
        pnlGrupoHLayout.setVerticalGroup(
            pnlGrupoHLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 448, Short.MAX_VALUE)
        );

        tbpGrupos.addTab("H", pnlGrupoH);

        btnIniciarElim1.setText("Siguiente Fase");
        btnIniciarElim1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIniciarElim1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlFaseGruposLayout = new javax.swing.GroupLayout(pnlFaseGrupos);
        pnlFaseGrupos.setLayout(pnlFaseGruposLayout);
        pnlFaseGruposLayout.setHorizontalGroup(
            pnlFaseGruposLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlFaseGruposLayout.createSequentialGroup()
                .addContainerGap(810, Short.MAX_VALUE)
                .addComponent(btnIniciarElim1)
                .addGap(27, 27, 27))
            .addGroup(pnlFaseGruposLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnlFaseGruposLayout.createSequentialGroup()
                    .addGap(5, 5, 5)
                    .addComponent(tbpGrupos, javax.swing.GroupLayout.PREFERRED_SIZE, 925, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        pnlFaseGruposLayout.setVerticalGroup(
            pnlFaseGruposLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlFaseGruposLayout.createSequentialGroup()
                .addComponent(btnIniciarElim1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 465, Short.MAX_VALUE))
            .addGroup(pnlFaseGruposLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnlFaseGruposLayout.createSequentialGroup()
                    .addGap(35, 35, 35)
                    .addComponent(tbpGrupos, javax.swing.GroupLayout.PREFERRED_SIZE, 453, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        tbpMundial.addTab(" Fase de Grupos ", pnlFaseGrupos);

        javax.swing.GroupLayout pnlOctavosLayout = new javax.swing.GroupLayout(pnlOctavos);
        pnlOctavos.setLayout(pnlOctavosLayout);
        pnlOctavosLayout.setHorizontalGroup(
            pnlOctavosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 935, Short.MAX_VALUE)
        );
        pnlOctavosLayout.setVerticalGroup(
            pnlOctavosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 504, Short.MAX_VALUE)
        );

        tbpMundial.addTab(" Octavos de final ", pnlOctavos);

        javax.swing.GroupLayout pnlCuartosLayout = new javax.swing.GroupLayout(pnlCuartos);
        pnlCuartos.setLayout(pnlCuartosLayout);
        pnlCuartosLayout.setHorizontalGroup(
            pnlCuartosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 935, Short.MAX_VALUE)
        );
        pnlCuartosLayout.setVerticalGroup(
            pnlCuartosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 504, Short.MAX_VALUE)
        );

        tbpMundial.addTab(" Cuartos de final ", pnlCuartos);

        javax.swing.GroupLayout pnlSemiLayout = new javax.swing.GroupLayout(pnlSemi);
        pnlSemi.setLayout(pnlSemiLayout);
        pnlSemiLayout.setHorizontalGroup(
            pnlSemiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 935, Short.MAX_VALUE)
        );
        pnlSemiLayout.setVerticalGroup(
            pnlSemiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 504, Short.MAX_VALUE)
        );

        tbpMundial.addTab(" Semi final ", pnlSemi);

        javax.swing.GroupLayout pnlFinalLayout = new javax.swing.GroupLayout(pnlFinal);
        pnlFinal.setLayout(pnlFinalLayout);
        pnlFinalLayout.setHorizontalGroup(
            pnlFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 935, Short.MAX_VALUE)
        );
        pnlFinalLayout.setVerticalGroup(
            pnlFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 504, Short.MAX_VALUE)
        );

        tbpMundial.addTab(" Final ", pnlFinal);

        pnlMundial.add(tbpMundial, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 940, 520));

        getContentPane().add(pnlMundial, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 77, -1, 520));

        pnlMainHeader.setBackground(java.awt.Color.white);

        lblNroMundTitle.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblNroMundTitle.setForeground(new java.awt.Color(0, 102, 255));
        lblNroMundTitle.setText("Mundial: ");

        lblNroMundial.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N
        lblNroMundial.setText("09");

        lblInicioMundTitle.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblInicioMundTitle.setForeground(new java.awt.Color(0, 102, 255));
        lblInicioMundTitle.setText("Inicio:");

        lblFechaInicio.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblFechaInicio.setText("03/03/2014");

        lblFinMundTitle.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblFinMundTitle.setForeground(new java.awt.Color(0, 102, 255));
        lblFinMundTitle.setText("Fin:");

        lblFechaFin.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblFechaFin.setText("03/03/2014");

        lblAnfitrionMundTitle.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblAnfitrionMundTitle.setForeground(new java.awt.Color(0, 102, 255));
        lblAnfitrionMundTitle.setText("Anfitrión:");

        lblBanderaAnf.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        lblNombreAnfitrion.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        lblNombreAnfitrion.setText("URUGUAY");

        javax.swing.GroupLayout pnlMainHeaderLayout = new javax.swing.GroupLayout(pnlMainHeader);
        pnlMainHeader.setLayout(pnlMainHeaderLayout);
        pnlMainHeaderLayout.setHorizontalGroup(
            pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 710, Short.MAX_VALUE)
            .addGroup(pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                    .addGap(0, 29, Short.MAX_VALUE)
                    .addComponent(lblNroMundTitle)
                    .addGap(9, 9, 9)
                    .addComponent(lblNroMundial, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(20, 20, 20)
                    .addGroup(pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(lblInicioMundTitle)
                        .addComponent(lblFinMundTitle))
                    .addGap(4, 4, 4)
                    .addGroup(pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                            .addGap(2, 2, 2)
                            .addComponent(lblFechaInicio))
                        .addComponent(lblFechaFin))
                    .addGap(60, 60, 60)
                    .addComponent(lblAnfitrionMundTitle)
                    .addGap(5, 5, 5)
                    .addComponent(lblBanderaAnf, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(15, 15, 15)
                    .addComponent(lblNombreAnfitrion, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 29, Short.MAX_VALUE)))
        );
        pnlMainHeaderLayout.setVerticalGroup(
            pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 80, Short.MAX_VALUE)
            .addGroup(pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                    .addGap(0, 13, Short.MAX_VALUE)
                    .addGroup(pnlMainHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(lblNroMundTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblNroMundial, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                            .addComponent(lblInicioMundTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(6, 6, 6)
                            .addComponent(lblFinMundTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                            .addComponent(lblFechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(6, 6, 6)
                            .addComponent(lblFechaFin, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                            .addGap(10, 10, 10)
                            .addComponent(lblAnfitrionMundTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                            .addGap(4, 4, 4)
                            .addComponent(lblBanderaAnf, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(pnlMainHeaderLayout.createSequentialGroup()
                            .addGap(11, 11, 11)
                            .addComponent(lblNombreAnfitrion, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(0, 13, Short.MAX_VALUE)))
        );

        getContentPane().add(pnlMainHeader, new org.netbeans.lib.awtextra.AbsoluteConstraints(-2, 0, 710, 80));

        pnlMainLoad.setBackground(java.awt.Color.white);

        lblLoad.setFont(new java.awt.Font("Trebuchet MS", 1, 10)); // NOI18N
        lblLoad.setText("CARGANDO");

        lblBallLoad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/211.GIF"))); // NOI18N

        javax.swing.GroupLayout pnlMainLoadLayout = new javax.swing.GroupLayout(pnlMainLoad);
        pnlMainLoad.setLayout(pnlMainLoadLayout);
        pnlMainLoadLayout.setHorizontalGroup(
            pnlMainLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlMainLoadLayout.createSequentialGroup()
                .addContainerGap(172, Short.MAX_VALUE)
                .addGroup(pnlMainLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblLoad)
                    .addComponent(lblBallLoad))
                .addGap(25, 25, 25))
        );
        pnlMainLoadLayout.setVerticalGroup(
            pnlMainLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMainLoadLayout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(lblBallLoad)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblLoad)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(pnlMainLoad, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 0, 250, 80));

        jPanel1.setBackground(java.awt.Color.white);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 9, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 520, Short.MAX_VALUE)
        );

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 80, -1, 520));

        mnuMundial.setText("Mundial     ");
        mnuMundial.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        mnuNuevo.setText("Nuevo");
        mnuNuevo.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N

        mnuItNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        mnuItNew.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        mnuItNew.setText("Standar");
        mnuItNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItNewActionPerformed(evt);
            }
        });
        mnuNuevo.add(mnuItNew);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        jMenuItem1.setText("Fifa 15");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        mnuNuevo.add(jMenuItem1);

        mnuMundial.add(mnuNuevo);

        mnuMundialHist.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        mnuMundialHist.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        mnuMundialHist.setText("Histórico");
        mnuMundialHist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMundialHistActionPerformed(evt);
            }
        });
        mnuMundial.add(mnuMundialHist);

        mnuEnCurso.setText("En curso");
        mnuEnCurso.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N

        mnuItEnCursoStandar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        mnuItEnCursoStandar.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        mnuItEnCursoStandar.setText("Standar");
        mnuItEnCursoStandar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItEnCursoStandarActionPerformed(evt);
            }
        });
        mnuEnCurso.add(mnuItEnCursoStandar);

        mnuItEnCursoFifaX.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        mnuItEnCursoFifaX.setText("Fifa 15");
        mnuItEnCursoFifaX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItEnCursoFifaXActionPerformed(evt);
            }
        });
        mnuEnCurso.add(mnuItEnCursoFifaX);

        mnuMundial.add(mnuEnCurso);

        mnuPrincipal.add(mnuMundial);

        mnuEstad.setText("Estadísticas");
        mnuEstad.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        mnuRankingFifa.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
        mnuRankingFifa.setText("Ranking FIFA");
        mnuRankingFifa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuRankingFifaActionPerformed(evt);
            }
        });
        mnuEstad.add(mnuRankingFifa);

        mnuPrincipal.add(mnuEstad);

        mnuAdministracion.setText("      Administración");
        mnuAdministracion.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        mnuAdmPais.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        mnuAdmPais.setText("Paises");
        mnuAdmPais.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuAdmPaisActionPerformed(evt);
            }
        });
        mnuAdministracion.add(mnuAdmPais);

        mnuAdmConfe.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        mnuAdmConfe.setText("Confederaciones");
        mnuAdmConfe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuAdmConfeActionPerformed(evt);
            }
        });
        mnuAdministracion.add(mnuAdmConfe);

        mnuPrincipal.add(mnuAdministracion);

        setJMenuBar(mnuPrincipal);

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void mnuMundialHistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMundialHistActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_mnuMundialHistActionPerformed

    private void mnuAdmConfeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAdmConfeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_mnuAdmConfeActionPerformed

    private void mnuAdmPaisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAdmPaisActionPerformed
        // TODO add your handling code here:
        manager.getPaisABM();
    }//GEN-LAST:event_mnuAdmPaisActionPerformed

    private void btnIniciarElimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIniciarElimActionPerformed
        manager.iniciarEliminatoria();
    }//GEN-LAST:event_btnIniciarElimActionPerformed

    private void btnRegistrarEncuentroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistrarEncuentroActionPerformed
        // TODO add your handling code here:
        manager.resgistrarEncuentro();
    }//GEN-LAST:event_btnRegistrarEncuentroActionPerformed

    private void btnIniciarElim1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIniciarElim1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnIniciarElim1ActionPerformed

    private void mnuRankingFifaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuRankingFifaActionPerformed
        manager.getRankingFIFA();

    }//GEN-LAST:event_mnuRankingFifaActionPerformed

    private void btnPasarASorteoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPasarASorteoActionPerformed
        // TODO add your handling code here:
        manager.getNextPhaseSorteo();
    }//GEN-LAST:event_btnPasarASorteoActionPerformed

    private void btnSorteoInitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSorteoInitActionPerformed
        
    }//GEN-LAST:event_btnSorteoInitActionPerformed

    private void mnuItNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItNewActionPerformed
        if (JOptionPane.showConfirmDialog(null, "¿Crear un nuevo mundial?") == 0) {
            manager.newMundial();
        }
    }//GEN-LAST:event_mnuItNewActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        if (JOptionPane.showConfirmDialog(null, "¿Crear un nuevo mundial FIFA 15?") == 0) {
            manager.newMundialFifa15();
        }
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void mnuItEnCursoStandarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItEnCursoStandarActionPerformed
        manager.runMundialEnCurso();
    }//GEN-LAST:event_mnuItEnCursoStandarActionPerformed

    private void mnuItEnCursoFifaXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItEnCursoFifaXActionPerformed
        manager.runMundialFifaXEnCurso();
    }//GEN-LAST:event_mnuItEnCursoFifaXActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Principal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnIniciarElim;
    private javax.swing.JButton btnIniciarElim1;
    private javax.swing.JButton btnPasarASorteo;
    private javax.swing.JButton btnRegistrarEncuentro;
    private javax.swing.JButton btnSorteoInit;
    private javax.swing.JFrame frmMundialFifaX;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JLabel lblAnfitrionMundTitle;
    private javax.swing.JLabel lblBallLoad;
    private javax.swing.JLabel lblBanderaAnf;
    private javax.swing.JLabel lblFechaFin;
    private javax.swing.JLabel lblFechaInicio;
    private javax.swing.JLabel lblFinMundTitle;
    private javax.swing.JLabel lblInicioMundTitle;
    private javax.swing.JLabel lblLoad;
    private javax.swing.JLabel lblNombreAnfitrion;
    private javax.swing.JLabel lblNroMundTitle;
    private javax.swing.JLabel lblNroMundial;
    private javax.swing.JMenuItem mnuAdmConfe;
    private javax.swing.JMenuItem mnuAdmPais;
    private javax.swing.JMenu mnuAdministracion;
    private javax.swing.JMenu mnuEnCurso;
    private javax.swing.JMenu mnuEstad;
    private javax.swing.JMenuItem mnuItEnCursoFifaX;
    private javax.swing.JMenuItem mnuItEnCursoStandar;
    private javax.swing.JMenuItem mnuItNew;
    private javax.swing.JMenu mnuMundial;
    private javax.swing.JMenuItem mnuMundialHist;
    private javax.swing.JMenu mnuNuevo;
    private javax.swing.JMenuBar mnuPrincipal;
    private javax.swing.JMenuItem mnuRankingFifa;
    private javax.swing.JPanel pnlAfc;
    private javax.swing.JPanel pnlCaf;
    private javax.swing.JPanel pnlConcacaf;
    private javax.swing.JPanel pnlConmebol;
    private javax.swing.JPanel pnlCuartos;
    private javax.swing.JPanel pnlEliminatorias;
    private javax.swing.JPanel pnlFaseGrupos;
    private javax.swing.JPanel pnlFinal;
    private javax.swing.JPanel pnlGrupoA;
    private javax.swing.JPanel pnlGrupoB;
    private javax.swing.JPanel pnlGrupoC;
    private javax.swing.JPanel pnlGrupoD;
    private javax.swing.JPanel pnlGrupoE;
    private javax.swing.JPanel pnlGrupoF;
    private javax.swing.JPanel pnlGrupoG;
    private javax.swing.JPanel pnlGrupoH;
    private javax.swing.JPanel pnlMainHeader;
    private javax.swing.JPanel pnlMainLoad;
    private javax.swing.JPanel pnlMundial;
    private javax.swing.JPanel pnlMundialFifaX;
    private javax.swing.JPanel pnlOctavos;
    private javax.swing.JPanel pnlOfc;
    private javax.swing.JPanel pnlSemi;
    private javax.swing.JPanel pnlSorteo;
    private javax.swing.JPanel pnlUefa;
    private javax.swing.JPanel pnlUefa1;
    private javax.swing.JPanel pnlUefa2;
    private javax.swing.JPanel pnlUefa3;
    private javax.swing.JPanel pnlUefa4;
    private javax.swing.JTable tblBombo_1;
    private javax.swing.JTable tblBombo_2;
    private javax.swing.JTable tblBombo_3;
    private javax.swing.JTable tblBombo_4;
    private javax.swing.JTabbedPane tbpConfederaciones;
    private javax.swing.JTabbedPane tbpGrupos;
    private javax.swing.JTabbedPane tbpMundial;
    private javax.swing.JTabbedPane tbpUefa;
    // End of variables declaration//GEN-END:variables

    private void loadForm() {
        lblBallLoad.setVisible(false);
        lblLoad.setVisible(false);
        btnPasarASorteo.setVisible(false);
        lblBanderaAnf.setVisible(false);
        manager.cargando(false, "");
        pnlMundial.setVisible(false);
        manager.showHeader(false);
        tabNames.put(0, "AFC");
        tabNames.put(1, "CAF");
        tabNames.put(2, "CONCACAF");
        tabNames.put(3, "CONMEBOL");
        tabNames.put(4, "OFC");
        tabNames.put(5, "UEFA");
        manager.createTables();
        frmMundialFifaX.setLocationRelativeTo(null);
        initTbpConfederaciones();

    }

    /*GETTERS*/
    public Map<Integer, String> getTabNames() {
        return tabNames;
    }

    public TableCustom2 getTblTablaAFC() {
        return tblTablaAFC;
    }

    public TableBombo getTblBombo1() {
        return tblBombo1;
    }
    
    public TableBombo getTblBombo2() {
        return tblBombo2;
    }
    
    public TableBombo getTblBombo3() {
        return tblBombo3;
    }
    
    public TableBombo getTblBombo4() {
        return tblBombo4;
    }
    
    public TableCustom2 getTblTablaConmebol() {
        return tblTablaConmebol;
    }

    public TableCustom2 getTblTablaCAF() {
        return tblTablaCAF;
    }

    public TableCustom2 getTblTablaCONCACAF() {
        return tblTablaCONCACAF;
    }

    public TableCustom2 getTblTablaOFC() {
        return tblTablaOFC;
    }

    public TableCustom2 getTblTablaUEFA1() {
        return tblTablaUEFA1;
    }

    public TableCustom2 getTblTablaUEFA2() {
        return tblTablaUEFA2;
    }

    public TableCustom2 getTblTablaUEFA3() {
        return tblTablaUEFA3;
    }

    public TableCustom2 getTblTablaUEFA4() {
        return tblTablaUEFA4;
    }

    public JLabel getLblAnfitrionMundTitle() {
        return lblAnfitrionMundTitle;
    }

    public JLabel getLblBallLoad() {
        return lblBallLoad;
    }

    public JLabel getLblBanderaAnf() {
        return lblBanderaAnf;
    }

    public JLabel getLblFechaFin() {
        return lblFechaFin;
    }

    public JLabel getLblFechaInicio() {
        return lblFechaInicio;
    }

    public JLabel getLblFinMundTitle() {
        return lblFinMundTitle;
    }

    public JLabel getLblInicioMundTitle() {
        return lblInicioMundTitle;
    }

    public JLabel getLblLoad() {
        return lblLoad;
    }

    public JLabel getLblNombreAnfitrion() {
        return lblNombreAnfitrion;
    }

    public JLabel getLblNroMundTitle() {
        return lblNroMundTitle;
    }

    public JLabel getLblNroMundial() {
        return lblNroMundial;
    }

    public JPanel getPnlAfc() {
        return pnlAfc;
    }

    public JPanel getPnlCaf() {
        return pnlCaf;
    }

    public JPanel getPnlConcacaf() {
        return pnlConcacaf;
    }

    public JPanel getPnlConmebol() {
        return pnlConmebol;
    }

    public JPanel getPnlCuartos() {
        return pnlCuartos;
    }

    public JPanel getPnlEliminatorias() {
        return pnlEliminatorias;
    }

    public JPanel getPnlFaseGrupos() {
        return pnlFaseGrupos;
    }

    public JPanel getPnlFinal() {
        return pnlFinal;
    }

    public JPanel getPnlMainHeader() {
        return pnlMainHeader;
    }

    public JPanel getPnlMainLoad() {
        return pnlMainLoad;
    }

    public JPanel getPnlMundial() {
        return pnlMundial;
    }

    public JPanel getPnlOctavos() {
        return pnlOctavos;
    }

    public JPanel getPnlOfc() {
        return pnlOfc;
    }

    public JPanel getPnlSemi() {
        return pnlSemi;
    }

    public JPanel getPnlSorteo() {
        return pnlSorteo;
    }

    public JPanel getPnlUefa() {
        return pnlUefa;
    }

    public JPanel getPnlUefa1() {
        return pnlUefa1;
    }

    public JPanel getPnlUefa2() {
        return pnlUefa2;
    }

    public JPanel getPnlUefa3() {
        return pnlUefa3;
    }

    public JPanel getPnlUefa4() {
        return pnlUefa4;
    }

    public JTabbedPane getTbpConfederaciones() {
        return tbpConfederaciones;
    }

    public JTabbedPane getTbpMundial() {
        return tbpMundial;
    }

    public JTabbedPane getTbpUefa() {
        return tbpUefa;
    }

    public Map<String, TableCustom2> getMapElimTable() {
        return mapElimTable;
    }

    public JFrame getFrmMundialFifaX() {
        return frmMundialFifaX;
    }

    
    
    private void initTbpConfederaciones() {
        ChangeListener changeListener = new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                checkEliminatoriaComplete();
            }
        };
        tbpConfederaciones.addChangeListener(changeListener);
        tbpUefa.addChangeListener(changeListener);

    }

    public void checkEliminatoriaComplete() {
        if (manager.getElim().getFechaInicio() != null) {
            if (manager.getElim().getFechaFin() != null) {
                btnRegistrarEncuentro.setVisible(false);
            } else {
                btnRegistrarEncuentro.setVisible(true);
            }
            btnIniciarElim.setVisible(false);
        } else {
            btnIniciarElim.setVisible(true);
            btnRegistrarEncuentro.setVisible(false);
        }

        boolean showAvanceASorteo = true;

        for (Eliminatoria e : manager.getMundialEnCurso().getEliminatorias()) {
            if (e.getFechaFin() == null) {
                showAvanceASorteo = false;
                break;
            }
        }

        btnPasarASorteo.setVisible(showAvanceASorteo);

    }
}
